// import { checkStr } from "@/utils/judge";
import url from "@/axios/url";
const { mesUrl } = url();
let vm = null;
const sendThis = (_this) => {
  vm = _this;
};
export { sendThis };
import { getDict } from "@/api/common";
// import excelUpload from "@/components/excel-upload/excelUpload";
// import { exportUrl, exportCellUrl } from "@/api/process/mesProcess";
// 列表头按钮配置
export const operateList = {
  data () {
    const _this = this;
    return {
      operateList: [
        {
          name: $i18n.t("common.back"),
          type: "primary",
          icon: "el-icon-back",
          handleName: "back", // 点击时返回的标识
        },
      ],
    };
  },
};
// 行末按钮配置
export const rowConfig = [
  {
    name: $i18n.t("common.edit"),
    type: "primary",
    class: "row-btn-primary",
    handleName: "edit", // 点击时返回的标识
  },
];

// 搜索条件配置
export const searchConfig = {
  data () {
    const _this = this;
    return {
      searchConfig: {
        inline: true,
        formDesc: {
          boxCode: {
            type: "input",
            label: $i18n.t("cabinet.cellCode"),
          },
          boxName: {
            type: "input",
            label: $i18n.t("cabinet.cellLocation"),
          },
          status: {
            type: "select",
            label: $i18n.t("common.status"),
            prop: {
              value: "value",
              text: "description",
            },
            options: async () => {
              const list = await getDict('cabinet_cell_status');
              let _data = (list.data.result || []).filter((item) => item.value !== '0')
              return _data;
            },
          }
        },
      },
    };
  },
};

// var validatePass = (rule, value, callback) => {
//   setTimeout(() => {
//     if (!checkStr(value, "english-number")) {
//       callback(new Error($i18n.t("mesProcess.rule8")));
//     } else {
//       callback();
//     }
//   }, 100);
// };
// 新增/删除表单配置
export const formDescDialogMinxin = {
  data () {
    const self = this;
    return {
      formDescDialog: {
        span: 24,
        disabled: false,
        isShowSubmitBtn: true,
        rules: {
          boxCode: [
            { max: 16, message: $i18n.t("common.overlongPrompt", { length: 16 }), trigger: ["change", "blur"] }
          ],
          boxName: [
            { max: 20, message: $i18n.t("common.overlongPrompt", { length: 20 }), trigger: ["change", "blur"] }
          ],
        },
        formDesc: {
          boxCode: {
            type: "input",
            label: $i18n.t("cabinet.cellCode"),
            layout: 12,
            required: true,
            disabled: (d) => !!d.id,
          },
          boxName: {
            type: "input",
            label: $i18n.t("cabinet.cellLocation"),
            layout: 12,
            required: true,
          },
          status: {
            type: "select",
            label: $i18n.t("common.status"),
            layout: 12,
            required: true,
            disabled: (d) => !!d.id,
            prop: {
              value: "value",
              text: "description",
            },
            options: async () => {
              const list = await getDict('cabinet_cell_status');
              let _data = (list.data.result || []).filter((item) => item.value !== '0')
              return _data;
            },
          },
        },
      },
    };
  },
};

